feat(ai-gateway): add organization auto model routing#4056
feat(ai-gateway): add organization auto model routing#4056pandemicsyn wants to merge 13 commits into
Conversation
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
No current Files Reviewed (2 files)
Previous Review Summaries (7 snapshots, latest commit 9f9f610)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 9f9f610)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)No current Other Observations (not in diff)Issues found in changed code that no longer appears in the current PR diff and therefore could not receive an inline comment:
Files Reviewed (115 files)
Previous review (commit f753b11)Status: No Issues Found | Recommendation: Merge Executive SummarySingle commit addresses the previously flagged audit log issue by capturing Files Reviewed (2 incremental, 42 total)
Previous review (commit cf3f457)Status: No Issues Found | Recommendation: Merge Executive SummaryRefactors default model mutations to use Files Reviewed (42 files)
Previous review (commit 29a354e)Status: 1 Issue Found | Recommendation: Approve Executive SummaryRefactors the default model dialog and custom modes UI with a unified behavior endpoint (auto/specific/global). One minor suggestion: the audit log inside the transaction uses pre-transaction state for the global-reset case. Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Previous review (commit 412123c)Status: No Issues Found | Recommendation: Merge Executive SummaryIncremental changes cover a major tier-to-taxonomy refactoring across auto-routing contracts, decision engine, benchmarks, and admin UI, plus KiloClaw billing recovery UX, model catalog refresh for vision capabilities, cloud agent fork review flow, and CI/CD staging deployment. All changes are well-tested with no security, logic, or performance issues detected. Files Reviewed (40+ files changed since last review)
Previous review (commit b3107a9)Status: No Issues Found | Recommendation: Merge Executive SummaryThe previous WARNING about Files Reviewed (4 files changed since last review)
Previous review (commit 6e0261a)Status: 1 Issue Found | Recommendation: Address before merge Executive Summary
Overview
Issue Details (click to expand)WARNING
Files Reviewed (41 files)
Reviewed by gpt-5.4-20260305 · Input: 68K · Output: 4.4K · Cached: 162.3K Review guidance: REVIEW.md from base branch |
|
Fixed review feedback in b3107a9: BYOK ownership validation now accepts and uses the active transaction client inside Organization Auto settings/mode mutations. |
…ned-auto # Conflicts: # apps/web/src/app/api/openrouter/[...path]/route.ts
…ned-auto # Conflicts: # apps/web/src/lib/ai-gateway/providers/openrouter/index.ts
|
(will fix up the merge conflicts as they pop up - but not actively hacking on this beyond that) |
|
There are downsides of not telling the client which model is used:
Some of this can be mitigated by setting the |
Summary
kilo-auto/org, an Enterprise-only Organization Auto model that lets an organization choose which model should handle each Kilo mode.kilo-auto/orgis intentionally used rather than an org-name-derived ID: organization names are org owner mutable and not unique, and identity comes from authenticated organization context. This avoids rename migrations, stale cache keys, privacy leakage, and unbounded telemetry/catalog cardinality. Also, I think this name fits because its kilo’s “org” auto routing model.organizations.settings.org_auto_model:buildusesroutes.buildbefore falling back toroutes.code, andplanusesroutes.planbefore falling back toroutes.architect.org-default-model-configmode-default rollout with the neworganization-auto-model-routingPostHog toggle for canonical organization-wide routing.OrganizationModeConfig.defaultModelbridge and stores all routing only inorganizations.settings.org_auto_model.Verification
/tmp/org-auto-api-log.shagainst a local service, including modes/defaults/models and optional gateway requests.Visual Changes
Loom:
https://www.loom.com/share/30ded7b1543c4b2aa0d1e5989dc04d68
Reviewer Notes
organization-auto-model-routing, replacing the oldorg-default-model-configtoggle. Runtime routing remains data-driven for already-configured organizations, and disable remains available during rollback.